package com.heima.wemedia.controller.v1;

import com.heima.apis.article.IArticleClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.dtos.WmNewsDto;
import com.heima.model.wemedia.dtos.WmNewsPageReqDto;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.wemedia.service.WmNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/news")
public class NewsController {
    @Autowired
    private WmNewsService wmNewsService;


    @PostMapping("/list")
    public ResponseResult list(@RequestBody WmNewsPageReqDto dto){

        ResponseResult responseResult = wmNewsService.list(dto);
        return responseResult;
    }

    @PostMapping("/submit")
    public ResponseResult submit(@RequestBody WmNewsDto dto){

        ResponseResult responseResult = wmNewsService.submit(dto);
        return responseResult;
    }

    @PostMapping("/down_or_up")
    public ResponseResult DownOrUp(@RequestBody WmNewsDto dto){
        ResponseResult responseResult = wmNewsService.downOrUp(dto);
        return responseResult;
    }
}
